﻿@model SystemInfoModel

@inject Microsoft.AspNetCore.Http.IHttpContextAccessor httpContextAccessor;

@{
    //page title
    ViewBag.Title = T("Admin.System.SystemInfo").Text;
}

<div class="row">
    <div class="col-md-12">
        <div class="x_panel light form-fit">
            <div class="x_title">
                <div class="caption level-caption">
                    <i class="fa fa-tasks"></i>
                    @T("Admin.System.SystemInfo")
                </div>
                <vc:admin-widget widget-zone="system_info_buttons" additional-data="null" />
            </div>
            <div class="x_content form">
                <vc:admin-widget widget-zone="system_info_top" additional-data="null" />
                <div class="form-horizontal">
                    <div class="form-body">
                        <div class="x_content">
                            <div class="form-horizontal">
                                <div class="form-body">
                                    <div class="form-group">
                                        <admin-label asp-for="GrandVersion" />
                                        <div class="col-md-9 col-sm-9">
                                            <label class="control-label">@Model.GrandVersion</label>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <admin-label asp-for="OperatingSystem" />
                                        <div class="col-md-9 col-sm-9">
                                            <label class="control-label">@Model.OperatingSystem</label>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <admin-label asp-for="MachineName" />
                                        <div class="col-md-9 col-sm-9">
                                            <label class="control-label">@Model.MachineName</label>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <admin-label asp-for="AspNetInfo" />
                                        <div class="col-md-9 col-sm-9">
                                            <label class="control-label">@Model.AspNetInfo</label>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <admin-label asp-for="ServerTimeZone" />
                                        <div class="col-md-9 col-sm-9">
                                            <label class="control-label">@Model.ServerTimeZone</label>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <admin-label asp-for="ServerLocalTime" />
                                        <div class="col-md-9 col-sm-9">
                                            <label class="control-label">@Model.ServerLocalTime.ToString("F")</label>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <admin-label asp-for="ApplicationTime" />
                                        <div class="col-md-9 col-sm-9">
                                            <label class="control-label">@Model.ApplicationTime.ToString("F")</label>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <admin-label asp-for="UtcTime" />
                                        <div class="col-md-9 col-sm-9">
                                            <label class="control-label">@Model.UtcTime.ToString("F")</label>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <admin-label asp-for="RequestScheme" />
                                        <div class="col-md-9 col-sm-9">
                                            <label class="control-label">@httpContextAccessor.HttpContext.Request.Scheme</label>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <admin-label asp-for="IsHttps" />
                                        <div class="col-md-9 col-sm-9">
                                            <label class="control-label">@httpContextAccessor.HttpContext.Request.IsHttps</label>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <admin-label asp-for="ServerVariables" />
                                        <div class="col-md-9 col-sm-9">
                                            <label class="control-label">
                                                <a id="serverVariablesShowHide" href="javascript:toggleLoadedServerVariables();">@T("Admin.Common.Show")</a>
                                            </label>
                                            <div id="pnlServerVariables" style="display:none">
                                                @foreach (var serverVariable in Model.ServerVariables)
                                                {
                                                    @serverVariable.Name<text>:</text> @serverVariable.Value
                                                    <br />
                                                }
                                            </div>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <admin-label asp-for="LoadedAssemblies" />
                                        <div class="col-md-9 col-sm-9">
                                            <label class="control-label"><a id="loadedAssembliesShowHide" href="javascript:toggleLoadedAssemblies();">@T("Admin.Common.Show")</a></label>
                                            <div id="pnlLoadedAssemblies" style="display:none">
                                                @foreach (var assembly in Model.LoadedAssemblies)
                                                {
                                                    @assembly.FullName
                                                    if (!String.IsNullOrEmpty(assembly.Location))
                                                    {
                                                        <br />
                                                        <em>@assembly.Location</em>
                                                    }
                                                    <br />
                                                }
                                            </div>
                                        </div>
                                    </div>
                                </div>

                            </div>
                        </div>
                    </div>
                </div>
                <vc:admin-widget widget-zone="system_info_bottom" additional-data="null" />
            </div>
        </div>
    </div>
</div>


<script type="text/javascript">
    function toggleLoadedAssemblies() {
        $('#pnlLoadedAssemblies').toggle();
        if ($('#pnlLoadedAssemblies').css('display') == 'none') {
            $('#loadedAssembliesShowHide').html('@T("Admin.Common.Show")');
        }
        else {
            $('#loadedAssembliesShowHide').html('@T("Admin.Common.Hide")');
        }
    }

    function toggleLoadedServerVariables() {
        $('#pnlServerVariables').toggle();
        if ($('#pnlServerVariables').css('display') == 'none') {
            $('#serverVariablesShowHide').html('@T("Admin.Common.Show")');
        }
        else {
            $('#serverVariablesShowHide').html('@T("Admin.Common.Hide")');
        }
    }
</script>
